package model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

import model.alexa.Analyse;
import model.builtwith.AnalyseBuiltwith;
import model.header.AnalyseHeader;
import model.performance.AnalysePerformance;
import model.seo.AnalyseSeo;

@Entity
public class Site implements Serializable {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id_site;
	private String nom_site;
	private String description_site;
	private String url_site;
	private Date dateinsertionurl;
	@ManyToMany
	private List<User> users = new ArrayList<User>();
	@OneToMany(mappedBy = "site")
	private List<Analyse> p = new ArrayList<Analyse>();
	@OneToMany(mappedBy = "site")
	private List<AnalyseBuiltwith> built = new ArrayList<AnalyseBuiltwith>();

	@OneToMany(mappedBy = "sit")
	private List<AnalyseHeader> analHead = new ArrayList<AnalyseHeader>();

	@OneToMany(mappedBy = "siteP")
	private List<AnalysePerformance> perform = new ArrayList<AnalysePerformance>();

	@OneToMany(mappedBy="site_Seo")
	private List<AnalyseSeo> seo=new ArrayList<AnalyseSeo>();
	
	
	public List<AnalyseSeo> getSeo() {
		return seo;
	}

	public void setSeo(List<AnalyseSeo> seo) {
		this.seo = seo;
	}

	public List<AnalysePerformance> getPerform() {
		return perform;
	}

	public void setPerform(List<AnalysePerformance> perform) {
		this.perform = perform;
	}

	public List<AnalyseHeader> getAnalHead() {
		return analHead;
	}

	public void setAnalHead(List<AnalyseHeader> analHead) {
		this.analHead = analHead;
	}

	public List<AnalyseBuiltwith> getBuilt() {
		return built;
	}

	public void setBuilt(List<AnalyseBuiltwith> built) {
		this.built = built;
	}

	public Site() {
		super();
	}

	public List<Analyse> getP() {
		return p;
	}

	public void setP(List<Analyse> p) {
		this.p = p;
	}

	public Site(Long id_site, String nom_site, String description_site,
			String url_site, Date dateinsertionurl, List<User> users) {
		super();
		this.id_site = id_site;
		this.nom_site = nom_site;
		this.description_site = description_site;
		this.url_site = url_site;
		this.dateinsertionurl = dateinsertionurl;
		this.users = users;
	}

	public Site(String nom_site, String description_site, String url_site,
			Date dateinsertionurl, List<User> users) {
		super();
		this.nom_site = nom_site;
		this.description_site = description_site;
		this.url_site = url_site;
		this.dateinsertionurl = dateinsertionurl;
		this.users = users;
		for (User u : users) {
			List<Site> s = new ArrayList<Site>();
			s.add(this);
			u.setSites(s);
		}
	}

	public Long getId_site() {
		return id_site;
	}

	public void setId_site(Long id_site) {
		this.id_site = id_site;
	}

	public String getNom_site() {
		return nom_site;
	}

	public void setNom_site(String nom_site) {
		this.nom_site = nom_site;
	}

	public String getDescription_site() {
		return description_site;
	}

	public void setDescription_site(String description_site) {
		this.description_site = description_site;
	}

	public String getUrl_site() {
		return url_site;
	}

	public void setUrl_site(String url_site) {
		this.url_site = url_site;
	}

	public Date getDateinsertionurl() {
		return dateinsertionurl;
	}

	public void setDateinsertionurl(Date dateinsertionurl) {
		this.dateinsertionurl = dateinsertionurl;
	}

	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

}
